#include "log.h"
MyLogger::MyLogger()
{
	try
	{
		basic_sink = std::make_shared<spdlog::sinks::basic_file_sink_mt>("logs/basic_log");
		daily_sink = std::make_shared<spdlog::sinks::daily_file_sink_mt>("logs/daily_log/log", 23, 59);
	}
	catch (const spdlog::spdlog_ex& ex)
	{
		std::cout << "Log initialization failed: " << ex.what() << std::endl;
	}
}

std::shared_ptr<spdlog::logger> MyLogger::setBasicLogger(const char* logger_name)
{
	auto new_logger = std::make_shared<spdlog::logger>(logger_name, basic_sink);
	return new_logger;
}

std::shared_ptr<spdlog::logger> MyLogger::setDailyLogger(const char* logger_name)
{
	auto new_logger = std::make_shared<spdlog::logger>(logger_name, daily_sink);
	return new_logger;
}

std::string MyLogger::getSysError()
{
	std::string temp(strerror(errno));
	return temp;
}